package com.google.code.mamule.mail.mock;

import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;

import com.google.code.mamule.mail.Address;
import com.google.code.mamule.mail.Mail;
import com.google.code.mamule.mail.MailOption;
import com.google.code.mamule.mail.MailStatus;
import com.google.code.mamule.mail.Mailable;
import com.google.code.mamule.mail.Naming;
import com.google.code.mamule.print.PrintDocument;
import com.google.code.mamule.process.MailRenderer;
import com.google.code.mamule.process.MailRendererImpl;
import com.google.code.mamule.user.User;

public class test {

	public static void main(String[] args) {
		
		
		Mailable sender=new Mailable();
		Mailable receiver=new Mailable();
		Naming senderName=new Naming();
		senderName.setGivenName("Mueller");
		senderName.setSurName("Hans");
		senderName.setSalutation("Herr Dr.");
		
		sender.setName(senderName);
		
		Address senderAddress=new Address();
		senderAddress.setPostcode("3644");
		senderAddress.setCountry("Austria");
		senderAddress.setResidence("Pömling 7");
		senderAddress.setLocality("Emmersdorf");
		
		sender.setAddress(senderAddress);
		
		Naming receiverName=new Naming();
		receiverName.setGivenName("Proksch");
		receiverName.setSurName("Christoph");
		receiverName.setSalutation("Herr Dipl. Ing.");
		
		receiver.setName(receiverName);
		
		Address receiverAddress=new Address();
		receiverAddress.setPostcode("3644");
		receiverAddress.setCountry("Austria");
		receiverAddress.setResidence("Pömling 7");
		receiverAddress.setLocality("Emmersdorf");
		
		receiver.setAddress(receiverAddress);
		
		Set<Mailable> recs=new HashSet<Mailable>();
		recs.add(receiver);
		
		User u=new User();
		u.setIdentity(sender);
		
		Mail m=new Mail(u,recs,"hallo",null,null);
		
		MailRendererImpl mr=new MailRendererImpl();
		Iterable<PrintDocument> pd=mr.apply(m);
		
		for(PrintDocument tmp:pd){
			System.out.println(tmp.getSenderText());
			System.out.println(tmp.getReceiverText());
			System.out.println(tmp.getBodyText());
		}
		
	}

}
